package com.drako.tdgdx.helper;

import com.badlogic.gdx.math.Vector2;

public class GlobalHelper {

	public final static int TILESIZE = 15;
	public static int fieldWidth;
	public static int fieldHeight;
	public final static float FIELD_ZDEPTH =-50;
	public static long ticks;
	private static float tmpDelta;
	
	public static void tickUp(float delta){
		tmpDelta += delta;
		if(tmpDelta > 0.32f){
			tmpDelta =0;
			ticks++;
		}
	}
	
	public static Vector2 midOfPlayingField(){
		return new Vector2((fieldWidth*TILESIZE)/2,(fieldHeight*TILESIZE)/2);
	}

	public static Vector2 arrayToPos(int x, int y) {
		return new Vector2(x * GlobalHelper.TILESIZE, y * GlobalHelper.TILESIZE);
	}

	public static int posToArray(float i) {
		return (int) i / GlobalHelper.TILESIZE;
	}
}
